home *** CD-ROM | disk | FTP | other *** search
/ Nikkei Mac 20 / NIKKEI-MAC-CD-VOL-20-1998-12.ISO.7z / NIKKEI-MAC-CD-VOL-20-1998-12.ISO / デモソフトライブラリー / 日本テレコムODNスターターキット / Internet Setup / Modem Scripts / Best Data Smart One 28.8⁄33.6 / Best Data Smart One 28.8_33.6 next >
Text File  |  1997-05-20  |  9KB  |  508 lines

  1. !  Best Data Smart One 28.8/33.6
  2. !    Author:    Kris Kreutzman
  3. !
  4. !    Copyright:    ゥ 1991-1996 Apple Computer, Inc.    All Rights Reserved.
  5. !
  6. !    revision history:
  7. !        v2.1    as shipped with Apple PPP 1.0
  8. !       v2.2    update CARRIER/CONNECT parsing
  9. !
  10. !  'mlts' resource info for this modem:
  11. !    byte 1 == 01 -> modem HAS built-in error correction protocols
  12. !    byte 2 == 01 -> modem HAS built-in data compression protocols
  13. !    byte 3 == 39 -> max number of chars in varstr 7
  14. !    byte 4 == 39 -> max number of chars in varstr 8
  15. !    byte 5 == 39 -> max number of chars in varstr 9
  16. !    
  17. @ORIGINATE
  18. @ANSWER
  19. !
  20. ! ---- Initial modem setup ----
  21. !
  22. ! Set serial port speed depending upon the compression flag
  23. !    A higher rate with compression on to handle expanded data from the modem
  24. !    A lower rate closer to the DCE when compression is off
  25. ifstr 5 1 "0"
  26. serreset 57600, 0, 8, 1
  27. jump 2
  28. !
  29. @LABEL 1
  30. serreset 38400, 0, 8, 1
  31. !
  32. @LABEL 2
  33. hsreset 0 0 0 0 0 0
  34. settries 0
  35. !
  36. ! Get the modem's attention
  37. !
  38. matchclr
  39. matchstr 1 3 "OK¥13¥10"
  40. write "AT¥13"
  41. matchread 30
  42. !
  43. @LABEL 3
  44. !
  45. ! Setup the modem for the following:
  46. ! &F   -  Reset to factory settings
  47. ! E0   -  Turn command echo off
  48. ! S0=0 -  Turn off answering
  49. ! ¥N3  -  Select auto reliable mode
  50. ! W1   -  Report line speed, EC protocol and PC speed
  51. !
  52. matchclr
  53. matchstr 1 4   "OK¥13¥10"
  54. matchstr 2 101 "ERROR¥13¥10"
  55. write "AT&FE0¥¥N3W1S7=75S0=0¥13"
  56. matchread 30
  57. inctries
  58. iftries 3 101
  59. !
  60. ! Reset the Modem on setup failure
  61. !
  62. DTRClear
  63. pause 5
  64. DTRSet
  65. flush
  66. jump 3
  67. !
  68. !
  69. @LABEL 4
  70. ! Varstring 4 , reliable link protocol:
  71. !    = 0, handled by computer (ARAP)
  72. !    = 1, handled by modem (PPP)
  73. !    = 2, MNP10 protocol (Cellular protocol, no longer supported)
  74. ifstr 4 5 "1"
  75. ifstr 4 5 "2"
  76. !
  77. ! Varstring 4 == 0, turn off reliable link protocol in modem (ARAP)
  78. matchclr
  79. matchstr 1 9 "OK¥13¥10"
  80. write "AT¥¥N0¥13"
  81. matchread 30
  82. jump 101
  83. !
  84. !
  85. @LABEL 5
  86. ! Varstring 5, compression protocol:
  87. !    = 0, handled by computer 
  88. !    = 1, handled by modem
  89. ifstr 5 9 "1"
  90. !
  91. ! Varstring 5 == 0, turn off compression protocol in modem.
  92. matchclr
  93. matchstr 1 9 "OK¥13¥10"
  94. write "AT%C0¥13"
  95. matchread 30
  96. jump 101
  97. !
  98. !
  99. @LABEL 9
  100. ! Varstring 2, modem speaker:
  101. !    = 0, speaker off
  102. !    = 1, speaker on
  103. ifstr 2 13 "1"
  104. pause 5
  105. matchclr
  106. matchstr 1 13 "OK¥13¥10"
  107. write "ATM0¥13"
  108. matchread 30
  109. jump 101
  110. !
  111. ! Modem ready, wait for a call or originate a call
  112. !
  113. @LABEL 13
  114. ifANSWER 32
  115. !
  116. !
  117. ! ---- Originating a call ----
  118. !
  119. ! Varstring 6, dialing mode:
  120. !    = 0, normal dialing
  121. !    = 1, blind dialing
  122. !    = 2, manual dialing
  123. !    otherwise dial as ARA version 1.0
  124. ifstr 6 19 "0"
  125. ifstr 6 17 "1"
  126. ifstr 6 15 "2"
  127. !
  128. ! Dialing for ARA version 1.0
  129. note "Dialing ^1" 3
  130. write "ATD^3^1¥13
  131. jump 32
  132. !
  133. @LABEL 15
  134. ! Display ASK dialog with message.  Goto label 107 if dialog canceled.
  135. ASK 2 "Pick up the phone & dial ^1.  When the phone rings, click OK then hang up." 107
  136. note "Manual dialing initiated" 3
  137. ! X1 to ignore dialtone & busy, D to dial, ¥^ generates data tone
  138. write "ATX1D¥13"
  139. jump 32
  140. !
  141. @LABEL 17
  142. note "Dialing without tone" 3
  143. matchclr
  144. matchstr 1 19 "OK¥13¥10"
  145. ! X1 to ignore dialtone & busy
  146. write "ATX1¥13"
  147. matchread 30
  148. jump 101
  149. !
  150. !
  151. !
  152. @LABEL 19
  153. ! Display the full dialstring contained in Varstring 1
  154. note "Dialing ^1" 3
  155. !
  156. ! Varstrings 7, 8 and 9, contain dialstring fragments
  157. !    Long phone numbers may need to be split into smaller groups
  158. !    for the modem to use
  159. !
  160. ! Varstring 3:  "p" for pulse & "t" for tone dialing
  161. ! Varstring 8 == blank (dialstring in varstring 7)
  162. ! Varstring 9 == blank (dialstring in varstrings 7 & 8)
  163. ! Otherwise (dialstring in varstrings 7, 8 & 9)
  164. ! ¥^ is added to the dialstring to force the modem to generate a data tone
  165. ifstr 8 27 " "
  166. ifstr 9 24 " "
  167. !
  168. !  Write dialstring in varstrings 7, 8 & 9
  169. matchclr
  170. matchstr 1 21 "OK¥13¥10"
  171. write "ATD^3^7;¥13"
  172. matchread 400
  173. jump 101
  174.  
  175. @LABEL 21
  176. matchclr
  177. matchstr 1 22 "OK¥13¥10"
  178. write "ATD^3^8;¥13"
  179. matchread 400
  180. jump 101
  181.  
  182. @LABEL 22
  183. write "ATD^3^9¥13"
  184. jump 32
  185. !
  186. !
  187. @LABEL 24
  188. !  Write dialstring in varstrings 7 & 8
  189. matchclr
  190. matchstr 1 25 "OK¥13¥10"
  191. write "ATD^3^7;¥13"
  192. matchread 400
  193. jump 101
  194.  
  195. @LABEL 25
  196. write "ATD^3^8¥13"
  197. jump 32
  198. !
  199. @LABEL 27
  200. !  Write dialstring in varstring 7
  201. write "ATD^3^7¥13"
  202. !
  203. !
  204. !    ---- Connection responce ----
  205. !
  206. ! The following section will parse modem responces of two types:
  207. !   1) CARRIER xxx, PROTOCOL: yyy, COMPRESSION: yyy, CONNECT xxx
  208. !   2) CONNECT xxx/yyy
  209. !
  210. @LABEL 32
  211. settries 0
  212. @LABEL 33
  213. matchclr
  214. matchstr  1 81  "RING¥13¥10"
  215. matchstr  2 102 "NO DIALTONE¥13¥10"
  216. matchstr  3 103 "NO CARRIER"
  217. matchstr  4 103 "ERROR¥13¥10"
  218. matchstr  5 104 "BUSY¥13¥10"
  219. matchstr  6 105 "NO ANSWER¥13¥10"
  220. matchstr  7 35  "CONNECT"
  221. matchstr  8 34  "CARRIER"
  222. matchstr  9 62  "PROTOCOL: LAP"
  223. matchstr 10 62  "PROTOCOL: MNP"
  224. matchstr 11 62  "PROTOCOL: ALT"
  225. matchstr 12 67  "COMPRESSION: V"
  226. matchstr 13 67  "COMPRESSION: MNP5"
  227. matchstr 14 67  "COMPRESSION: CLASS"
  228. matchread 700
  229. ifANSWER 32
  230. jump 105
  231. !
  232. !  CARRIER parsing
  233. !
  234. @LABEL 34
  235. jsr 38
  236. inctries
  237. jump 33
  238. !
  239. !  CONNECT parsing - do not parse rate if CARRIER seen
  240. !
  241. @LABEL 35
  242. iftries 1 61
  243. jsr 38
  244. jump 61
  245. !
  246. !  Parse CONNECT/CARRIER rate subroutine
  247. !    2400 and 4800 have two entries each
  248. !    to distinguish them from 24000 and 48000
  249. !
  250. @LABEL 38
  251. matchclr
  252. matchstr  1 40 "2400¥13"
  253. matchstr  2 40 "2400/"
  254. matchstr  3 41 "4800¥13"
  255. matchstr  4 41 "4800/"
  256. matchstr  5 42 "7200"
  257. matchstr  6 43 "9600"
  258. matchstr  7 44 "12000"
  259. matchstr  8 45 "14400"
  260. matchstr  9 46 "16800"
  261. matchstr 10 47 "19200"
  262. matchstr 11 48 "21600"
  263. matchstr 12 49 "24000"
  264. matchstr 13 50 "26400"
  265. matchstr 14 51 "28800"
  266. matchstr 15 52 "31200"
  267. matchstr 16 53 "33600"
  268. matchread 10
  269. jump 59
  270. !
  271. ! -- Connection rates --
  272. ! CommunicatingAt informs ARA of the raw modem to modem
  273. ! connection speed.
  274. !
  275. @LABEL 40
  276. note "Communicating at 2400 bps." 2
  277. CommunicatingAt 2400
  278. jump 60
  279. !
  280. @LABEL 41
  281. note "Communicating at 4800 bps." 2
  282. CommunicatingAt 4800
  283. jump 60
  284. !
  285. @LABEL 42
  286. note "Communicating at 7200 bps." 2
  287. CommunicatingAt 7200
  288. jump 60
  289. !
  290. @LABEL 43
  291. note "Communicating at 9600 bps." 2
  292. CommunicatingAt 9600
  293. jump 60
  294. !
  295. @LABEL 44
  296. note "Communicating at 12400 bps." 2
  297. CommunicatingAt 12400
  298. jump 60
  299. !
  300. @LABEL 45
  301. note "Communicating at 14400 bps." 2
  302. CommunicatingAt 14400
  303. jump 60
  304. !
  305. @LABEL 46
  306. note "Communicating at 16800 bps." 2
  307. CommunicatingAt 16800
  308. jump 60
  309. !
  310. @LABEL 47
  311. note "Communicating at 19200 bps." 2
  312. CommunicatingAt 19200
  313. jump 60
  314. !
  315. @LABEL 48
  316. note "Communicating at 21600 bps." 2
  317. CommunicatingAt 21600
  318. jump 60
  319. !
  320. @LABEL 49
  321. note "Communicating at 24000 bps." 2
  322. CommunicatingAt 24000
  323. jump 60
  324. !
  325. @LABEL 50
  326. note "Communicating at 26400 bps." 2
  327. CommunicatingAt 26400
  328. jump 60
  329. !
  330. @LABEL 51
  331. note "Communicating at 28800 bps." 2
  332. CommunicatingAt 28800
  333. jump 60
  334. !
  335. @LABEL 52
  336. note "Communicating at 31200 bps." 2
  337. CommunicatingAt 31200
  338. jump 60
  339. !
  340. @LABEL 53
  341. note "Communicating at 33600 bps." 2
  342. CommunicatingAt 33600
  343. jump 60
  344. !
  345. @LABEL 59
  346. note "Communicating at an unknown rate." 2
  347. !
  348. @LABEL 60
  349. return
  350. !
  351. ! Look for reliablilty and compression results 
  352. ! after the CONNECT rate.
  353. !
  354. @LABEL 61
  355. matchclr
  356. matchstr  1 63 "LAPM"
  357. matchstr  2 63 "REL"
  358. matchstr  3 63 "ARQ"
  359. matchstr  4 68 "COMP/"
  360. matchstr  5 68 "COMP¥13"
  361. matchstr  6 63 "V42/"
  362. matchstr  7 63 "V42¥13"
  363. matchstr  8 68 "V42BIS"
  364. matchstr  9 68 "V42bis"
  365. matchstr 10 63 "MNP¥13"
  366. matchstr 11 68 "MNP5"
  367. matchstr 12 70 "¥10"
  368. matchread 10
  369. jump 70
  370.  
  371. ! -- Modem error correction link negotiation --
  372. ! Userhook 2 informs ARA that a modem-to-modem error
  373. ! correcting protocol has been negotiated
  374. !
  375. !
  376. @LABEL 62
  377. note "Modem Reliable Link Established." 2
  378. userhook 2
  379. jump 33
  380. !
  381. @LABEL 63
  382. note "Modem Reliable Link Established." 2
  383. userhook 2
  384. jump 61
  385. !
  386. ! -- Compression negotiation --
  387. ! Userhook 3 informs ARA that a modem-to-modem compression
  388. ! protocol has been negotiated
  389. !
  390. @LABEL 67
  391. note "Modem Compression Established." 2
  392. userhook 3
  393. jump 33
  394. !
  395. @LABEL 68
  396. note "Modem Compression Established." 2
  397. userhook 3
  398. jump 61
  399. !
  400. !
  401. ! -- Normal exit after "CONNECT" --
  402. !
  403. !  This modem has been setup to do CTS handshaking,
  404. !  and we assume that a CTS handshaking cable is being used.
  405. !
  406. @LABEL 70
  407. ! Turn on CTS handshaking.
  408. HSReset 0 1 0 0 0 0
  409. !
  410. ifANSWER 71
  411. pause 30
  412. @LABEL 71
  413. exit 0
  414. !
  415. !
  416. ! ---- Answer calls ----
  417. !
  418. !    A RING result from the modem and in ANSWERING mode
  419. !    claims the serial port and answering the phone
  420. !
  421. @LABEL 81
  422. ifORIGINATE 32
  423. userhook 1
  424. note "Answering phone..." 2
  425. write "ATA¥13"
  426. jump 32
  427. !
  428. !
  429. ! ---- Hang up and reset modem ----
  430. !
  431. @HANGUP
  432. @LABEL 90
  433. settries 0
  434. HSReset 0 0 0 0 0 0
  435. !
  436. @LABEL 92
  437. !  Escape from data to command mode
  438. matchclr
  439. matchstr 1 96 "OK¥13¥10"
  440. write "+++"
  441. matchread 20
  442. !
  443. @LABEL 94
  444. ! Force a hangup
  445. matchclr
  446. matchstr 1 98 "NO CARRIER¥13¥10"
  447. matchstr 2 98 "OK¥13¥10"
  448. matchstr 3 98 "ERROR¥13¥10"
  449. matchstr 4 98 "0¥13¥10"
  450. write "ATH¥13"
  451. matchread 30
  452. ! Try to get control of the modem by toggling DTR
  453. DTRClear
  454. pause 5
  455. DTRSet
  456. flush
  457. !
  458. ! Try the hangup sequence three times otherwise declare and error
  459. inctries
  460. iftries 3 101
  461. jump 92
  462. !
  463. @LABEL 96
  464. ! Pause between data and command mode
  465. pause 50
  466. jump 94
  467. !
  468. !
  469. @LABEL 98
  470. ! Recall the factory settings
  471. pause 15
  472. matchclr
  473. matchstr 1 99 "OK¥13¥10"
  474. write "AT&F¥13"
  475. matchread 30
  476. jump 101
  477. !
  478. @LABEL 99
  479. exit 0
  480. !
  481. ! ---- Error messages -----
  482. !
  483. ! Modem Not Responding
  484. @LABEL 101
  485. exit -6019
  486. !
  487. ! No Dial Tone
  488. @LABEL 102
  489. exit -6020
  490. !
  491. ! No Carrier or Error
  492. @LABEL 103
  493. exit -6021
  494. !
  495. ! Busy
  496. @LABEL 104
  497. exit -6022
  498. !
  499. ! No Answer
  500. @LABEL 105
  501. exit -6023
  502. !
  503. ! User Cancellation
  504. @LABEL 107
  505. exit -6008
  506.